import java.net.*;
import java.io.*;
import java.util.*;

public class GameServer {

    public static void main(String[] args) {
    
	Engine engine = new Engine();
	int inputPort = 19998;
	int outputPort = 19999;
	int count = 0;

	try{

	    ServerSocket ssin = new ServerSocket(inputPort);
	    ServerSocket ssout = new ServerSocket(outputPort);
	    System.out.println("GameServer Initialized");

	    while (true) {

		Socket sin = ssin.accept();
		Socket sout = ssout.accept();
		
		Runnable runnable = new ActionHandler(engine, sin, sout, ++count);
		Thread thread = new Thread(runnable);

		thread.start();

	    }
	}
	catch (Exception e) {}
    }

}    
    
